package calorie.com.calorie.contact;

import android.content.Context;


import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;
import com.lxh.baselibray.util.ToastUtils;

import calorie.com.calorie.api.ApiService;
import calorie.com.calorie.response.NoticeListResponce;
import retrofit2.Call;
import retrofit2.Response;

public class NoticeListContact {
    public static class NoticeListPresent extends BasePresent<INoticeListView>{
        public void getNoticeList(Context context,int pageNo){
            ApiService service= ServiceGenerator.createService(ApiService.class);
            service.getNoticeList(pageNo).enqueue(new NetCallBack<NoticeListResponce>() {
                @Override
                public void onSuccess(Call<NoticeListResponce> call, Response<NoticeListResponce> response) {
                    if (getView()!=null){
                        getView().getNoticeListData(response);
                    }
                }

                @Override
                public void onFailed() {
                    //ToastUtils.showLongToast(context,"网络请求异常");
                }
            });

        }
    }
    public interface INoticeListView extends IBaseView{
        void getNoticeListData(Response<NoticeListResponce> response);
    }
}
